# REPLICATION CODE FOR REILLY S. STEEL. 2024. "PARTISAN BIAS IN SECURITIES ENFORCEMENT."
# JOURNAL OF LAW, ECONOMICS, & ORGANIZATION
# ENFORCEMENT ANALYSIS

#### SETUP ####

rm(list = ls(all.names = TRUE)) # clear environment

options(scipen = 8, digits = 5)

setwd("~/Desktop/Projects/SEC Enforcement/Replication") # set working directory

# load packages

library(tidyverse)
library(RColorBrewer)
library(lubridate)
library(fixest)
library(texreg)
library(datawizard)
library(vtable)
library(tikzDevice)
library(kableExtra)
library(patchwork)
library(cobalt)

# load data

load("Data/data_for_enforcement_analysis.RData")

#### DESCRIPTIVE STATS ####

# distribution of firm_party

density1 <- ggplot(firms_enf_larger_sample, aes(firm_party)) +
  geom_density(kernel = "gaussian") +
  labs(title = "Density of Firm Party (All Firms, 2010-2021)", x = "Firm Party", y = "Density") +
  theme(plot.title = element_text(hjust = 0.5))

density2 <- ggplot(firms_enf, aes(firm_party)) +
  geom_density(kernel = "gaussian") +
  labs(title = "Density of Firm Party (\\$5k+ Firms, 2010-2021)", x = "Firm Party", y = "Density") +
  theme(plot.title = element_text(hjust = 0.5))

# explore how many are off-center

firms_enf <- firms_enf %>%
  group_by(year) %>%
  mutate(firm_party_annual_mean = mean(firm_party)) %>%
  ungroup() %>%
  mutate(dist_from_mean_firm_party = abs(firm_party - firm_party_annual_mean),
         dist_from_center = abs(firm_party - 0.5))

mean(firms_enf$dist_from_mean_firm_party) # mean distance from annual mean is 0.26
mean(firms_enf$dist_from_center) # mean distance from center is 0.27
mean(firms_enf$firm_party[firms_enf$firm_party < 0.5])
# ---> mean Democratic firm has score of 0.24
mean(firms_enf$firm_party[firms_enf$firm_party > 0.5])
# ---> mean Republican firm has score of 0.78

# how many enforcement targets are within my sample?

nrow(enf_actions_sample) / nrow(enf_actions_all) 
# ---> 62% of the enf actions are against firms w/in my sample
sum(enf_actions_sample$total_money) / sum(enf_actions_all$total_money) 
# ---> 85% of the monetary sanctions are against firms w/in my sample

# compute within-firm volatility of firm_party

firm_party_stats <- firms_enf %>%
  group_by(gvkey) %>%
  summarize(firm_party_mean = mean(firm_party, na.rm = TRUE),
            firm_party_sd = sd(firm_party, na.rm = TRUE))

firm_party_by_year <- firms_enf %>%
  group_by(year) %>%
  summarize(firm_party_mean = mean(firm_party, na.rm = TRUE),
            firm_party_sd = sd(firm_party, na.rm = TRUE))

sd(firms_enf$firm_party) # sd of firm party score is 0.31
mean(firm_party_stats$firm_party_sd, na.rm = TRUE) # mean within-firm firm party sd = 0.06
mean(firm_party_by_year$firm_party_sd, na.rm = TRUE) # mean within-year firm party sd = 0.31
mean(firms_enf$firm_party, na.rm = TRUE) # mean firm party score is 0.56

firm_party_sd_within <- ggplot(firm_party_stats, aes(firm_party_sd)) +
  geom_density(kernel = "gaussian") +
  labs(x = "Within-Firm Standard Deviation of Firm Party", y = "Density")

# firm_party by industry

industry_names <- c("Consumer Nondurables", "Consumer Durables", "Manufacturing", "Energy", "Chemicals",
                    "Business Equipment", "Telecom", "Utilities", "Shops", "Healthcare", "Finance", "Other")

industry_party_all_years$FF_12_names <- reorder(as.factor(industry_names),
                                                 industry_party_all_years$FF_12_party_all_years,
                                                 median,
                                                 decreasing = TRUE)

party_by_industry <- ggplot(industry_party_all_years, aes(x = FF_12_names, y = FF_12_party_all_years)) +
  coord_cartesian(ylim = c(0.4,0.8)) +
  geom_col(aes(fill = FF_12_names)) +
  labs(title = "Mean Firm Partisanship by Industry", x = "Industry", y = "Firm Party") +
  scale_fill_brewer(palette = "Set3") +
  theme(legend.position = "none", axis.text.x = element_text(angle = 45, hjust = 1),
        plot.title = element_text(hjust = 0.5), axis.title.x = element_blank())

# targeted v. non-targeted firms by party control

dem_targets <- firms_enf %>%
  filter(sec_party == 0 & action_dummy == 1) %>%
  summarize(mean_assets = mean(at, na.rm = TRUE),
            mean_leverage = mean(leverage, na.rm = TRUE),
            mean_emp = mean(emp, na.rm = TRUE),
            mean_rev = mean(revt, na.rm = TRUE),
            mean_ni = mean(ni, na.rm = TRUE),
            mean_roa = mean(roa, na.rm = TRUE),
            mean_op_margin = mean(op_margin, na.rm = TRUE),
            mean_cd_hh_inc = mean(cd_med_hh_inc, na.rm = TRUE),
            mean_cd_unemp_rate = mean(cd_unemp_rate, na.rm = TRUE),
            mean_cd_finance_workers = mean(cd_finance_workers, na.rm = TRUE),
            mean_sbc_rep = mean(sbc_rep, na.rm = TRUE),
            mean_hfsc_rep = mean(hfsc_rep, na.rm = TRUE),
            mean_sen_app_rep = mean(senApp_rep, na.rm = TRUE),
            mean_house_app_rep = mean(houseApp_rep, na.rm = TRUE),
            mean_firm_party = mean(firm_party, na.rm = TRUE),
            mean_tot_lagged = mean(tot_lagged, na.rm = TRUE),
            mean_cd_repub_tendency = mean(cd_repub_tendency, na.rm = TRUE),
            mean_agg_money = mean(agg_money, na.rm = TRUE)
  ) %>%
  t()

repub_targets <- firms_enf %>%
  filter(sec_party == 1 & action_dummy == 1) %>%
  summarize(mean_assets = mean(at, na.rm = TRUE),
            mean_leverage = mean(leverage, na.rm = TRUE),
            mean_emp = mean(emp, na.rm = TRUE),
            mean_rev = mean(revt, na.rm = TRUE),
            mean_ni = mean(ni, na.rm = TRUE),
            mean_roa = mean(roa, na.rm = TRUE),
            mean_op_margin = mean(op_margin, na.rm = TRUE),
            mean_cd_hh_inc = mean(cd_med_hh_inc, na.rm = TRUE),
            mean_cd_unemp_rate = mean(cd_unemp_rate, na.rm = TRUE),
            mean_cd_finance_workers = mean(cd_finance_workers, na.rm = TRUE),
            mean_sbc_rep = mean(sbc_rep, na.rm = TRUE),
            mean_hfsc_rep = mean(hfsc_rep, na.rm = TRUE),
            mean_sen_app_rep = mean(senApp_rep, na.rm = TRUE),
            mean_house_app_rep = mean(houseApp_rep, na.rm = TRUE),
            mean_firm_party = mean(firm_party, na.rm = TRUE),
            mean_tot_lagged = mean(tot_lagged, na.rm = TRUE),
            mean_cd_repub_tendency = mean(cd_repub_tendency, na.rm = TRUE),
            mean_agg_money = mean(agg_money, na.rm = TRUE)
  ) %>%
  t()

dem_nontargets <- firms_enf %>%
  filter(sec_party == 0 & action_dummy == 0) %>%
  summarize(mean_assets = mean(at, na.rm = TRUE),
            mean_leverage = mean(leverage, na.rm = TRUE),
            mean_emp = mean(emp, na.rm = TRUE),
            mean_rev = mean(revt, na.rm = TRUE),
            mean_ni = mean(ni, na.rm = TRUE),
            mean_roa = mean(roa, na.rm = TRUE),
            mean_op_margin = mean(op_margin, na.rm = TRUE),
            mean_cd_hh_inc = mean(cd_med_hh_inc, na.rm = TRUE),
            mean_cd_unemp_rate = mean(cd_unemp_rate, na.rm = TRUE),
            mean_cd_finance_workers = mean(cd_finance_workers, na.rm = TRUE),
            mean_sbc_rep = mean(sbc_rep, na.rm = TRUE),
            mean_hfsc_rep = mean(hfsc_rep, na.rm = TRUE),
            mean_sen_app_rep = mean(senApp_rep, na.rm = TRUE),
            mean_house_app_rep = mean(houseApp_rep, na.rm = TRUE),
            mean_firm_party = mean(firm_party, na.rm = TRUE),
            mean_tot_lagged = mean(tot_lagged, na.rm = TRUE),
            mean_cd_repub_tendency = mean(cd_repub_tendency, na.rm = TRUE),
            mean_agg_money = mean(agg_money, na.rm = TRUE)
  ) %>%
  t()

repub_nontargets <- firms_enf %>%
  filter(sec_party == 1 & action_dummy == 0) %>%
  summarize(mean_assets = mean(at, na.rm = TRUE),
            mean_leverage = mean(leverage, na.rm = TRUE),
            mean_emp = mean(emp, na.rm = TRUE),
            mean_rev = mean(revt, na.rm = TRUE),
            mean_ni = mean(ni, na.rm = TRUE),
            mean_roa = mean(roa, na.rm = TRUE),
            mean_op_margin = mean(op_margin, na.rm = TRUE),
            mean_cd_hh_inc = mean(cd_med_hh_inc, na.rm = TRUE),
            mean_cd_unemp_rate = mean(cd_unemp_rate, na.rm = TRUE),
            mean_cd_finance_workers = mean(cd_finance_workers, na.rm = TRUE),
            mean_sbc_rep = mean(sbc_rep, na.rm = TRUE),
            mean_hfsc_rep = mean(hfsc_rep, na.rm = TRUE),
            mean_sen_app_rep = mean(senApp_rep, na.rm = TRUE),
            mean_house_app_rep = mean(houseApp_rep, na.rm = TRUE),
            mean_firm_party = mean(firm_party, na.rm = TRUE),
            mean_tot_lagged = mean(tot_lagged, na.rm = TRUE),
            mean_cd_repub_tendency = mean(cd_repub_tendency, na.rm = TRUE),
            mean_agg_money = mean(agg_money, na.rm = TRUE)
  ) %>%
  t()

firm_stats <- tibble(variable = rownames(dem_targets),
                     dem_targets = as.numeric(dem_targets[,1]),
                     dem_nontargets = as.numeric(dem_nontargets[,1]),
                     repub_targets = as.numeric(repub_targets[,1]),
                     repub_nontargets = as.numeric(repub_nontargets[,1]))

firm_stats_table <- firm_stats %>%
  mutate(variable = c("Assets",
                      "Leverage",
                      "Employment",
                      "Revenue",
                      "Net Income",
                      "Return on Assets",
                      "Operating Margin",
                      "CD Median Household Income",
                      "CD Unemployment Rate",
                      "CD Finance Workers",
                      "SBC",
                      "HFSC",
                      "S. Approp.",
                      "H. Approp.",
                      "Firm Party",
                      "Total Contribs.",
                      "CD Republican Tendency",
                      "Aggregate Monetary Assessments")) %>%
  mutate(order = c(9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 4, 5, 6, 7, 1, 2, 3, 8)) %>%
  filter(!variable %in% c("CD Median Household Income", "CD Unemployment Rate", "CD Finance Workers",
                          "CD Republican Tendency", "Aggregate Monetary Assessments")) %>%
  arrange(order) %>%
  select(-order) %>%
  rename(" " = variable,
         "Targets (D)" = dem_targets,
         "Nontargets (D)" = dem_nontargets,
         "Targets (R)" = repub_targets,
         "Nontargets (R)" = repub_nontargets) %>%
  kbl(format = "latex", digits = 2) %>%
  kable_classic_2(full_width = F) %>%
  add_header_above(c(" " = 1, "Democratic SEC" = 2, "Republican SEC" = 2))

# balance table


balance_table_data <- firms_enf %>%
  filter(!is.na(firm_party), !is.na(firm_alignment), !is.na(log_tot_lagged), !is.na(sbc_rep), !is.na(hfsc_rep), !is.na(senApp_rep),
         !is.na(houseApp_rep), !is.na(log_lobbying_lagged), !is.na(log_lobbying_lagged_sec_rel), !is.na(log_tot_comm_contribs_lagged)) %>%
  mutate(finance_industry = if_else(FF_12 == 11, 1, 0))

balance_table <- bal.tab(firm_alignment ~ at + capx + ceq + ch + dt + emp + ni + oiadp + revt + roa + leverage +
                           op_margin + cd_med_hh_inc + cd_unemp_rate + cd_finance_workers + tot_lagged +
                           sbc_rep + senApp_rep + hfsc_rep + houseApp_rep + recent_ca + recent_restatement + finance_industry,
                         data = balance_table_data)

balance_table$Balance$Variable <- rownames(balance_table$Balance)

rownames(balance_table$Balance) <- NULL

# plot timing

rep_firm_targets <- enf_actions_sample %>%
  rename(year = year_p) %>%
  left_join(firm_party_by_year) %>%
  mutate(rep_firm_dummy = if_else(firm_party >= firm_party_mean, 1, 0)) %>%
  filter(rep_firm_dummy == 1)

dem_firm_targets <- enf_actions_sample %>%
  rename(year = year_p) %>%
  left_join(firm_party_by_year) %>%
  mutate(rep_firm_dummy = if_else(firm_party >= firm_party_mean, 1, 0)) %>%
  filter(rep_firm_dummy == 0)

enf_date_density <- ggplot() +
  geom_rect(aes(xmin = ymd("2010-01-20"), xmax = ymd("2017-01-20"), ymin = 0, ymax = 0.00035), fill = "blue", alpha = 0.15) +
  geom_rect(aes(xmin = ymd("2017-01-20"), xmax = ymd("2021-01-20"), ymin = 0, ymax = 0.00035), fill = "red", alpha = 0.2) +
  geom_rect(aes(xmin = ymd("2021-01-20"), xmax = ymd("2022-01-20"), ymin = 0, ymax = 0.00035), fill = "blue", alpha = 0.15) +
  geom_vline(xintercept = c(ymd("2017-01-20"), ymd("2021-01-20")), linetype = "solid", color = "black", alpha = 0.75) +
  geom_density(data = rep_firm_targets, aes(x = date), color = "Red", kernel = "r") +
  geom_density(data = dem_firm_targets, aes(x = date), color = "Blue", linetype = "longdash", kernel = "r") +
  coord_cartesian(xlim = c(ymd("2010-01-20"), ymd("2022-01-20")), ylim = c(0, 0.00035), expand = FALSE) +
  scale_x_date(breaks = c(seq.Date(ymd("2013-01-20"), ymd("2021-01-20"), "4 years")),
               minor_breaks = seq.Date(ymd("2010-01-20"), ymd("2022-01-20"), "1 year")) +
  theme_bw() +
  labs(x = "Date", y = "Density")

#### MAIN ANALYSIS ####

# prob. models

m1 <- feglm(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep 
            + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
            | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1.5 <- feglm(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
              + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
              | gvkey + year, firms_enf, family = binomial(link = "logit"))

m2 <- feols(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
              houseApp_rep  + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
            | gvkey + year, firms_enf)


m2.5 <- feols(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
              + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
              | gvkey + year, firms_enf)

# count models

m3 <- fepois(n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep
             + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged 
             | gvkey + year, firms_enf)

m3.5 <- fepois(n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                 houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
               | gvkey + year, firms_enf)

m4 <- feols(log_n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
              houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
            | gvkey + year, firms_enf)

m4.5 <- feols(log_n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
              + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
              | gvkey + year, firms_enf)

# money model

m5 <- feols(log_agg_money ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
              houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
            | gvkey + year, firms_enf)

m5.5 <- feols(log_agg_money ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
              + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
              | gvkey + year, firms_enf)

# run key regressions with firm alignment on scale of 2 (so we can interpret effect as 0.5 point increase in alignment)

m1_sc2 <- feglm(action_dummy ~ firm_party + firm_alignment_2 + log_tot_lagged + sbc_rep + hfsc_rep
                + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged 
                | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1.5_sc2 <- feglm(action_dummy ~ firm_party + firm_alignment_2 + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                    houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                  + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                  | gvkey + year, firms_enf, family = binomial(link = "logit"))

m3_sc2 <- fepois(n_actions ~ firm_party + firm_alignment_2 + log_tot_lagged + sbc_rep + hfsc_rep
                 + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged 
                 | gvkey + year, firms_enf)

m3.5_sc2 <- fepois(n_actions ~ firm_party + firm_alignment_2 + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                     houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                   + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                   | gvkey + year, firms_enf)

m5_sc2 <- feols(log_agg_money ~ firm_party + firm_alignment_2 + log_tot_lagged + sbc_rep + hfsc_rep
                + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged 
                | gvkey + year, firms_enf)

m5.5_sc2 <- feols(log_agg_money ~ firm_party + firm_alignment_2 + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                    houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                  + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                  | gvkey + year, firms_enf)

# effect plots (for a half-point change in alignment)

get_p2 <- function(p1, beta) {p1 / (1 - p1) * exp(beta) / (1 + p1 / (1 - p1) * exp(beta))} # helper function to generate ex post probability

effect1_half <- as.numeric(summary(m1_sc2)$coefficients[2])
effect2_half <- as.numeric(summary(m1.5_sc2)$coefficients[2])
effect3_half <- as.numeric(summary(m3_sc2)$coefficients[2])
effect4_half <- as.numeric(summary(m3.5_sc2)$coefficients[2])

pr_effect1_half <- (get_p2(0.5, effect1_half) - 0.5) / 0.5
pr_effect2_half <- (get_p2(0.5, effect2_half) - 0.5) / 0.5

lowerCI_1_half <- effect1_half - 1.96 * summary(m1_sc2)$se[2]
upperCI_1_half <- effect1_half + 1.96 * summary(m1_sc2)$se[2]
lowerCI_2_half <- effect2_half - 1.96 * summary(m1.5_sc2)$se[2]
upperCI_2_half <- effect2_half + 1.96 * summary(m1.5_sc2)$se[2]

pr_lowerCI_1_half <- (get_p2(0.5, lowerCI_1_half) - 0.5) / 0.5
pr_upperCI_1_half <- (get_p2(0.5, upperCI_1_half) - 0.5) / 0.5
pr_lowerCI_2_half <- (get_p2(0.5, lowerCI_2_half) - 0.5) / 0.5
pr_upperCI_2_half <- (get_p2(0.5, upperCI_2_half) - 0.5) / 0.5

lowerCI_3_half <- effect3_half - 1.96 * summary(m3_sc2)$se[2]
upperCI_3_half <- effect3_half + 1.96 * summary(m3_sc2)$se[2]
lowerCI_4_half <- effect4_half - 1.96 * summary(m3.5_sc2)$se[2]
upperCI_4_half <- effect4_half + 1.96 * summary(m3.5_sc2)$se[2]

effect_plot_1_half <- tibble(Model = c("Logit 1", "Logit 2", "Poisson 1", "Poisson 2"),
                             Effect = 100 * c(pr_effect1_half, pr_effect2_half, exp(effect3_half) - 1, exp(effect4_half) - 1),
                             lowerCI = 100 * c(pr_lowerCI_1_half, pr_lowerCI_2_half, exp(lowerCI_3_half) - 1, exp(lowerCI_4_half) - 1),
                             upperCI = 100 * c(pr_upperCI_1_half, pr_upperCI_2_half, exp(upperCI_3_half) - 1, exp(upperCI_4_half) - 1))

coefplot1_half <- ggplot(data = effect_plot_1_half, aes(x = Model, y = Effect)) +
  geom_pointrange(aes(x = Model, y = Effect * 100, ymax = upperCI * 100, ymin = lowerCI * 100)) +
  labs(y = "Effect") +
  coord_cartesian(ylim = c(-5000, 0))

# preds for half-point change

m1.pred_half <- tibble(p1 = seq(0,1, by = 0.01)) %>%
  mutate(p2 = get_p2(p1, effect1_half),
         p2_low = get_p2(p1, lowerCI_1_half),
         p2_high = get_p2(p1, upperCI_1_half),
         pr_effect = -(p1 - p2) / p1,
         pr_effect_low = -(p1 - p2_low) / p1,
         pr_effect_high = -(p1 - p2_high) / p1,
         p2_2 = get_p2(p1, effect2_half),
         p2_2_low = get_p2(p1, lowerCI_2_half),
         p2_2_high = get_p2(p1, upperCI_2_half),
         pr_effect_2 = -(p1 - p2_2) / p1,
         pr_effect_2_low = -(p1 - p2_2_low) / p1,
         pr_effect_2_high = -(p1 - p2_2_high) / p1)

m1.pred_plot_half <- ggplot(data = m1.pred_half, aes(x = p1)) +
  geom_line(aes(y = pr_effect)) +
  geom_ribbon(aes(ymax = pr_effect_high, ymin = pr_effect_low), fill = "blue", alpha = 0.15) +
  labs(x = "Ex Ante Likelihood of Enforcement", y = "Effect",
       title = "Model 1 (Logit)") +
  coord_cartesian(ylim = c(-0.6,0))

m1.5.pred_plot_half <- ggplot(data = m1.pred_half, aes(x = p1)) +
  geom_line(aes(y = pr_effect_2)) +
  geom_ribbon(aes(ymax = pr_effect_2_high, ymin = pr_effect_2_low), fill = "blue", alpha = 0.15) +
  labs(x = "Ex Ante Likelihood of Enforcement", y = "",
       title = "Model 2 (Logit)") +
  coord_cartesian(ylim = c(-0.6,0))

#### ADDITIONAL ROBUSTNESS CHECKS / ALTERNATIVE EXPLANATIONS ####

# industry analysis

m11 <- feglm(action_dummy ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
               houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
             | gvkey + year, firms_enf, family = binomial(link = "logit"))

m11.5 <- feglm(action_dummy ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                 houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
               | gvkey + year, firms_enf, family = binomial(link = "logit"))

m12 <- feols(action_dummy ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
               houseApp_rep  + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
             | gvkey + year, firms_enf)

m12.5 <- feols(action_dummy ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                 houseApp_rep  + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
               | gvkey + year, firms_enf)

m13 <- fepois(n_actions ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
              | gvkey + year, firms_enf)

m13.5 <- fepois(n_actions ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                  houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                | gvkey + year, firms_enf)

m14 <- feols(log_n_actions ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
               houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
             | gvkey + year, firms_enf)

m14.5 <- feols(log_n_actions ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                 houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
               | gvkey + year, firms_enf)

m15 <- feols(log_agg_money ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
               houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
             | gvkey + year, firms_enf)

m15.5 <- feols(log_agg_money ~ industry_party + industry_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                 houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
               | gvkey + year, firms_enf)

# robustness checks with industry-year FE

m1_ind_year_fe <- feglm(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep 
                        + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                        | gvkey + year^FF_12, firms_enf, family = binomial(link = "logit"))

m1.5_ind_year_fe <- feglm(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                            houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                          + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                          | gvkey + year^FF_12, firms_enf, family = binomial(link = "logit"))

m3_ind_year_fe <- fepois(n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep
                         + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged 
                         | gvkey + year^FF_12, firms_enf)

m3.5_ind_year_fe <- fepois(n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                             houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                           + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                           | gvkey + year^FF_12, firms_enf)

m5_ind_year_fe <- feols(log_agg_money ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                          houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                        | gvkey + year^FF_12, firms_enf)

m5.5_ind_year_fe <- feols(log_agg_money ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                            houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                          + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                          | gvkey + year^FF_12, firms_enf)

screenreg(list(m1_ind_year_fe, m1.5_ind_year_fe, m3_ind_year_fe, m3.5_ind_year_fe, m5_ind_year_fe, m5.5_ind_year_fe),
          stars = c(0.001, 0.01, 0.05, 0.1),
          symbol = "+")

# geographic analysis

m16 <- feglm(action_dummy ~ sec_party * cd_repub_tendency + margin + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + houseApp_rep + 
               log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
             | gvkey + year, firms_enf, family = binomial(link = "logit"))

m16.5 <- feglm(action_dummy ~ sec_party * cd_repub_tendency + margin + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + houseApp_rep + finance_x_time
               + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
               | gvkey + year, firms_enf, family = binomial(link = "logit"))

m17 <- fepois(n_actions ~ sec_party * cd_repub_tendency + margin + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + houseApp_rep + 
                log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
              | gvkey + year, firms_enf)

m17.5 <- fepois(n_actions ~ sec_party * cd_repub_tendency + margin + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + houseApp_rep + finance_x_time 
                + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                | gvkey + year, firms_enf)

m18 <- feols(log_agg_money ~ sec_party * cd_repub_tendency + margin + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + houseApp_rep + 
               log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
             | gvkey + year, firms_enf)

m18.5 <- feols(log_agg_money ~ sec_party * cd_repub_tendency + margin + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + houseApp_rep + finance_x_time
               + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
               | gvkey + year, firms_enf)

# partisan differences in types of actions?

enf_actions_sample_repub <- enf_actions_sample %>% filter(sec_party == 1)

enf_actions_sample_dem <- enf_actions_sample %>% filter(sec_party == 0)

firm_party_by_action_type <- enf_actions_sample %>%
  group_by(action_primary_category) %>%
  summarize(mean_firm_party_for_action = mean(firm_party)) %>%
  ungroup()

action_type_pcts <- enf_actions_sample %>%
  group_by(sec_party, action_primary_category) %>%
  dplyr::count() %>%
  ungroup() %>%
  rbind(tibble(sec_party = c(1), action_primary_category = c("Insider Trading"), n = c(0))) %>%
  group_by(sec_party) %>%
  mutate(tot_actions = sum(n)) %>%
  ungroup() %>%
  mutate(pct = n / tot_actions * 100,
         sec_party = as.factor(if_else(sec_party == 1, "Republican SEC", "Democratic SEC"))) %>%
  left_join(firm_party_by_action_type) %>%
  arrange(desc(mean_firm_party_for_action))

action_type_pcts_repub <- action_type_pcts %>%
  filter(sec_party == "Republican SEC")

action_type_pcts_dem <- action_type_pcts %>%
  filter(sec_party == "Democratic SEC")

mean_firm_party <- mean(enf_actions_sample$firm_party) # mean firm party for all enforcement actions

action_type_pcts_plot <- ggplot(action_type_pcts,
                                aes(x = fct_reorder(action_primary_category, mean_firm_party_for_action, .desc = TRUE),
                                    y = pct,
                                    fill = mean_firm_party_for_action)) +
  geom_col(color = "black") +
  scale_fill_gradient(name = "Mean Defendant Party", low = "blue", high = "red",
                      guide = guide_colorbar(frame.colour = "black", ticks.colour = "black")) +
  facet_grid(sec_party ~.) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1),
        plot.title = element_text(hjust = 0.5), axis.title.x = element_blank()) +
  labs(y = "Percentage of Actions in Category")

# regress the % for the category on the SEC's party

pct_category_model <- lm(pct ~ sec_party * mean_firm_party_for_action, action_type_pcts)

summary(pct_category_model)

# run main regressions on the n_contribs filtered data

m1_nc <- feglm(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep 
               + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               | gvkey + year, firms_enf_nc, family = binomial(link = "logit"))

m1.5_nc <- feglm(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                   houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                 + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                 | gvkey + year, firms_enf_nc, family = binomial(link = "logit"))

m3_nc <- fepois(n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep
                + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged 
                | gvkey + year, firms_enf_nc)

m3.5_nc <- fepois(n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                    houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                  + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                  | gvkey + year, firms_enf_nc)

m5_nc <- feols(log_agg_money ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                 houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               | gvkey + year, firms_enf_nc)

m5.5_nc <- feols(log_agg_money ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                   houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                 + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                 | gvkey + year, firms_enf_nc)


# interact alignment w/ tot contribs

m1_tot <- feglm(action_dummy ~ firm_party * log_tot_lagged + sec_party * log_tot_lagged + firm_alignment * log_tot_lagged + sbc_rep + hfsc_rep 
                + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
                | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1.5_tot <- feglm(action_dummy ~ firm_party * log_tot_lagged + sec_party * log_tot_lagged + firm_alignment * log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                    houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                  + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                  | gvkey + year, firms_enf, family = binomial(link = "logit"))

m3_tot <- fepois(n_actions ~ firm_party * log_tot_lagged + sec_party * log_tot_lagged + firm_alignment * log_tot_lagged + sbc_rep + hfsc_rep
                 + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
                 | gvkey + year, firms_enf)

m3.5_tot <- fepois(n_actions ~ firm_party * log_tot_lagged + sec_party * log_tot_lagged + firm_alignment * log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                     houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                   + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                   | gvkey + year, firms_enf)

m5_tot <- feols(log_agg_money ~ firm_party * log_tot_lagged + sec_party * log_tot_lagged + firm_alignment * log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                  houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
                | gvkey + year, firms_enf)

m5.5_tot <- feols(log_agg_money ~ firm_party * log_tot_lagged + sec_party * log_tot_lagged + firm_alignment * log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                    houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                  + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                  | gvkey + year, firms_enf)


# test for election years

m1_elec_years <- feglm(action_dummy ~ firm_party * election_year + firm_alignment * election_year + log_tot_lagged + sbc_rep + hfsc_rep 
                       + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
                       | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1_post_elec <- feglm(action_dummy ~ firm_party * year_one + firm_alignment * year_one + log_tot_lagged + sbc_rep + hfsc_rep 
                      + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
                      | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1.5_elec_years <- feglm(action_dummy ~ firm_party * election_year + firm_alignment * election_year + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                           houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                         + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                         | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1.5_post_elec <- feglm(action_dummy ~ firm_party * year_one + firm_alignment * year_one + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                          houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                        + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                        | gvkey + year, firms_enf, family = binomial(link = "logit"))

m3_elec_years <- fepois(n_actions ~ firm_party * election_year + firm_alignment * election_year + log_tot_lagged + sbc_rep + hfsc_rep
                        + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
                        | gvkey + year, firms_enf)

m3_post_elec <- fepois(n_actions ~ firm_party * year_one + firm_alignment * year_one + log_tot_lagged + sbc_rep + hfsc_rep
                       + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
                       | gvkey + year, firms_enf)

m3.5_elec_years <- fepois(n_actions ~ firm_party * election_year + firm_alignment * election_year + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                            houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                          + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                          | gvkey + year, firms_enf)

m3.5_post_elec <- fepois(n_actions ~ firm_party * year_one + firm_alignment * year_one + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                           houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                         + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                         | gvkey + year, firms_enf)

# broken windows

m1_brokenwindows <- feglm(action_dummy ~ firm_party + firm_alignment * broken_windows  + log_tot_lagged + sbc_rep + hfsc_rep 
                          + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                          | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1.5_brokenwindows <- feglm(action_dummy ~ firm_party + firm_alignment * broken_windows  + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                              houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                            + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                            | gvkey + year, firms_enf, family = binomial(link = "logit"))

screenreg(list(m1_brokenwindows, m1.5_brokenwindows),
          stars = c(0.001, 0.01, 0.05, 0.1),
          symbol = "+")

# alternative specifications restricting to pac and/or employee spending

m1_pac <- feglm(action_dummy ~ firm_party_pac + firm_alignment_pac + log_tot_lagged + sbc_rep + hfsc_rep 
                + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1.5_pac <- feglm(action_dummy ~ firm_party_pac + firm_alignment_pac + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                    houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                  + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                  | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1_indv <- feglm(action_dummy ~ firm_party_indv + firm_alignment_indv + log_tot_lagged + sbc_rep + hfsc_rep 
                 + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                 | gvkey + year, firms_enf, family = binomial(link = "logit"))

m1.5_indv <- feglm(action_dummy ~ firm_party_indv + firm_alignment_indv + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                     houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                   + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                   | gvkey + year, firms_enf, family = binomial(link = "logit"))

m3_pac <- fepois(n_actions ~ firm_party_pac + firm_alignment_pac + log_tot_lagged + sbc_rep + hfsc_rep 
                 + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                 | gvkey + year, firms_enf)

m3.5_pac <- fepois(n_actions ~ firm_party_pac + firm_alignment_pac + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                     houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                   + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                   | gvkey + year, firms_enf)

m3_indv <- fepois(n_actions ~ firm_party_indv + firm_alignment_indv + log_tot_lagged + sbc_rep + hfsc_rep 
                  + senApp_rep + houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                  | gvkey + year, firms_enf)

m3.5_indv <- fepois(n_actions ~ firm_party_indv + firm_alignment_indv + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                      houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                    + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                    | gvkey + year, firms_enf)

m5_pac <- feols(log_agg_money ~ firm_party_pac + firm_alignment_pac + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                  houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                | gvkey + year, firms_enf)

m5.5_pac <- feols(log_agg_money ~ firm_party_pac + firm_alignment_pac + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                    houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                  + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                  | gvkey + year, firms_enf)

m5_indv <- feols(log_agg_money ~ firm_party_indv + firm_alignment_indv + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                   houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                 | gvkey + year, firms_enf)

m5.5_indv <- feols(log_agg_money ~ firm_party_indv + firm_alignment_indv + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                     houseApp_rep + finance_x_time  + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                   + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                   | gvkey + year, firms_enf)

# robustness checks cutting out 2021

firms_enf_no2021 <- firms_enf %>% filter(year < 2021)

m1_r <- feglm(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
              | gvkey + year, firms_enf_no2021, family = binomial(link = "logit"))

m1.5_r <- feglm(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                  houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                | gvkey + year, firms_enf_no2021, family = binomial(link = "logit"))

m2_r <- feols(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep  + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
              | gvkey + year, firms_enf_no2021)

m2.5_r <- feols(action_dummy ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                  houseApp_rep  + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                | gvkey + year, firms_enf_no2021)

m3_r <- fepois(n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                 houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
               | gvkey + year, firms_enf_no2021)

m3.5_r <- fepois(n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                   houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                 + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                 | gvkey + year, firms_enf_no2021)

m4_r <- feols(log_n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
              | gvkey + year, firms_enf_no2021)

m4.5_r <- feols(log_n_actions ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                  houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                | gvkey + year, firms_enf_no2021)

m5_r <- feols(log_agg_money ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
              | gvkey + year, firms_enf_no2021)

m5.5_r <- feols(log_agg_money ~ firm_party + firm_alignment + log_tot_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                  houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                | gvkey + year, firms_enf_no2021)

# total contribs analysis

m19 <- feglm(action_dummy ~ sec_party * log_tot_rep_lagged + sec_party * log_tot_dem_lagged + sbc_rep + hfsc_rep + senApp_rep + 
               houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
             | gvkey + year, firms_enf, family = binomial(link = "logit"))

m19.5 <- feglm(action_dummy ~ sec_party * log_tot_rep_lagged + sec_party * log_tot_dem_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                 houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
               | gvkey + year, firms_enf, family = binomial(link = "logit"))

m20 <- fepois(n_actions ~ sec_party * log_tot_rep_lagged + sec_party * log_tot_dem_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
              | gvkey + year, firms_enf)

m20.5 <- fepois(n_actions ~ sec_party * log_tot_rep_lagged + sec_party * log_tot_dem_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                  houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
                + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
                | gvkey + year, firms_enf)

m21 <- feols(log_agg_money ~ sec_party * log_tot_rep_lagged + sec_party * log_tot_dem_lagged + sbc_rep + hfsc_rep + senApp_rep + 
               houseApp_rep + log_lobbying_lagged + log_lobbying_lagged_sec_rel  + log_tot_comm_contribs_lagged
             | gvkey + year, firms_enf)

m21.5 <- feols(log_agg_money ~ sec_party * log_tot_rep_lagged + sec_party * log_tot_dem_lagged + sbc_rep + hfsc_rep + senApp_rep + 
                 houseApp_rep + finance_x_time + recent_restatement + log_lobbying_lagged + log_lobbying_lagged_sec_rel + log_tot_comm_contribs_lagged
               + recent_ca + log_at + leverage + roa + log_emp + op_margin + log_cd_unemp_rate + log_cd_finance_workers
               | gvkey + year, firms_enf)

#### PLOTS ####

# firm party density plots

options(tz="CA")

tikz(file = "Output/density1.tex", width = 5, height = 4)

density1 <- density1

print(density1)

dev.off()

options(tz="CA")

tikz(file = "Output/density2.tex", width = 5, height = 4)

density2 <- density2

print(density2)

dev.off()

# third plot

options(tz="CA")

tikz(file = "Output/party_by_industry.tex", width = 5, height = 4)

party_by_industry <- party_by_industry

print(party_by_industry)

dev.off()

# coefficient plot

options(tz="CA")

tikz(file = "Output/coefplot1_half.tex", width = 4.5, height = 4)

coefplot1_half <- coefplot1_half

print(coefplot1_half)

dev.off()

# within-firm standard deviation density

options(tz="CA")

tikz(file = "Output/firm_party_sd_within.tex", width = 5, height = 4)

firm_party_sd_within <- firm_party_sd_within

print(firm_party_sd_within)

dev.off()

# enf action density

options(tz="CA")

tikz(file = "Output/enf_density.tex", width = 4.5, height = 4)

enf_date_density <- enf_date_density

print(enf_date_density)

dev.off()

# predicted prob effect effects

options(tz="CA")

tikz(file = "Output/preds_half.tex", width = 5, height = 4)

preds_half <- m1.pred_plot_half + m1.5.pred_plot_half

print(preds_half)

dev.off()

# action categories

options(tz="CA")

tikz(file = "Output/categories.tex", width = 5, height = 4, sanitize = TRUE)

action_type_pcts_plot <- action_type_pcts_plot

print(action_type_pcts_plot)

dev.off()

#### TABLES ####

# descriptive / summary stats

sumtable(firms_enf,
         out = "latex", file = "Output/summary1.tex",
         title = "Summary Statistics (All U.S. Firms, Total Contribs. $5,000+)",
         vars = c("at", "capx", "ceq", "ch", "dt", "emp", "ni", "oiadp", "revt", "roa", "leverage",
                  "op_margin", "cd_med_hh_inc", "cd_unemp_rate", "cd_finance_workers", "tot_lagged",
                  "firm_party", "cd_repub_tendency", "sec_party", "sbc_rep", "senApp_rep",
                  "hfsc_rep", "houseApp_rep", "recent_ca", "recent_restatement", "action_dummy", "n_actions", "agg_money"),
         labels = c("Total Assets", "Capex", "Common Equity Outstanding",
                    "Cash", "Long-Term Debt", "Employment", "Net Income", "Operating Income After Depreciation", "Total Revenue",
                    "Return on Assets", "Leverage", "Operating Margin",
                    "CD Median Household Income", "CD Unemployment Rate",
                    "CD Finance Workers", "Total Contributions",
                    "Firm Party", "CD Republican Tendency", "SEC Party",
                    "SBC", "S. Approps.", "HFSC",
                    "H. Approps.", "Recent Securities Class Action", "Recent Restatement", "Enforcement", "Number of Enforcement Actions", 
                    "Total Monetary Sanctions"))

sumtable(enf_actions_sample,
         out = "latex", file = "Output/summary2.tex",
         title = "Summary Statistics (U.S. Enforcement Targets, Total Contribs. $5,000+)",
         vars = c("at", "capx", "ceq", "ch", "dt", "emp", "ni", "oiadp", "revt", "roa", "leverage",
                  "op_margin", "cd_med_hh_inc", "cd_unemp_rate", "cd_finance_workers", "tot_lagged",
                  "firm_party", "cd_repub_tendency", "sec_party", "sbc_rep", "senApp_rep",
                  "hfsc_rep", "houseApp_rep", "recent_ca", "recent_restatement", "action_dummy", "n_actions", "agg_money"),
         labels = c("Total Assets", "Capex", "Common Equity Outstanding",
                    "Cash", "Long-Term Debt", "Employment", "Net Income", "Operating Income After Depreciation", "Total Revenue",
                    "Return on Assets", "Leverage", "Operating Margin",
                    "CD Median Household Income", "CD Unemployment Rate",
                    "CD Finance Workers", "Total Contributions",
                    "Firm Party", "CD Republican Tendency", "SEC Party",
                    "SBC", "S. Approps.", "HFSC",
                    "H. Approps.", "Recent Securities Class Action", "Recent Restatement", "Enforcement", "Number of Enforcement Actions", 
                    "Total Monetary Sanctions"))

firm_stats_table %>% save_kable(file = "Output/firm_stats_table_enf.tex")

balance_table$Balance %>%
  as_tibble() %>%
  relocate(Variable) %>%
  dplyr::select(-Corr.Adj) %>%
  filter(!str_detect(Variable, "<NA>")) %>%
  kbl(format = "latex", digits = 2) %>%
  kable_classic_2(full_width = F) %>%
  save_kable(file = "Output/balance_table_enf.tex")

# regression tables

texreg(list(m1, m1.5, m3, m3.5),
       file = "Output/enf_main_table.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Political Controls" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Financial Controls" = c("", "\\checkmark", "", "\\checkmark")))

texreg(list(m1, m1.5, m3, m3.5),
       file = "Output/enf_main_table_full.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m1_pac, m1.5_pac, m3_pac, m3.5_pac),
       file = "Output/enf_pac.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("firm_party_pac" = "Firm Party (PAC)",
                              "firm_alignment_pac" = "Alignment (PAC)",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m1_indv, m1.5_indv, m3_indv, m3.5_indv),
       file = "Output/enf_indv.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("firm_party_indv" = "Firm Party (Individuals)",
                              "firm_alignment_indv" = "Alignment (Individuals)",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))


texreg(list(m1_nc, m1.5_nc, m3_nc, m3.5_nc),
       file = "Output/enf_nc.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m5, m5.5),
       file = "Output/enf_money.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark"),
                              "Political Controls" = c("\\checkmark", "\\checkmark"),
                              "Financial Controls" = c("", "\\checkmark")))

texreg(list(m5, m5.5),
       file = "Output/enf_money_full.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark")))

texreg(list(m5_pac, m5.5_pac),
       file = "Output/enf_money_pac.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("firm_party_pac" = "Firm Party (PAC)",
                              "firm_alignment_pac" = "Alignment (PAC)",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark")))

texreg(list(m5_indv, m5.5_indv),
       file = "Output/enf_money_indv.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("firm_party_indv" = "Firm Party (Individuals)",
                              "firm_alignment_indv" = "Alignment (Individuals)",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark")))

texreg(list(m5_nc, m5.5_nc),
       file = "Output/enf_money_nc.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark")))

texreg(list(m4, m4.5, m2, m2.5),
       file = "Output/enf_ols.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "Log(N. Enf.)",
                              "Log(N. Enf.)"),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m1_elec_years, m1.5_elec_years, m3_elec_years, m3.5_elec_years),
       file = "Output/enf_elec_years.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "firm_party:election_year" = "Firm Party $\\times$ Election Year",
                              "election_year:firm_alignment" = "Alignment $\\times$ Election Year",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m1_post_elec, m1.5_post_elec, m3_post_elec, m3.5_post_elec),
       file = "Output/enf_year_one.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "firm_party:year_one" = "Firm Party $\\times$ Year One",
                              "year_one:firm_alignment" = "Alignment $\\times$ Year One",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))



texreg(list(m1_tot, m1.5_tot, m3_tot, m3.5_tot),
       file = "Output/enf_tot.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "log_tot_lagged" = "Log(Total Contribs.)",
                              "firm_party:log_tot_lagged" = "Firm Party $\\times$ Log(Total Contribs.)",
                              "log_tot_lagged:sec_party" = "SEC Party $\\times$ Log(Total Contribs.)",
                              "log_tot_lagged:firm_alignment" = "Alignment $\\times$ Log(Total Contribs.)",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m5_tot, m5.5_tot),
       file = "Output/enf_tot_money.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "log_tot_lagged" = "Log(Total Contribs.)",
                              "firm_party:log_tot_lagged" = "Firm Party $\\times$ Log(Total Contribs.)",
                              "log_tot_lagged:sec_party" = "SEC Party $\\times$ Log(Total Contribs.)",
                              "log_tot_lagged:firm_alignment" = "Alignment $\\times$ Log(Total Contribs.)",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark")))

texreg(list(m1_r, m1.5_r, m3_r, m3.5_r),
       file = "Output/enf_no2021.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m5_r, m5.5_r),
       file = "Output/enf_money_no2021.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("firm_party" = "Firm Party",
                              "firm_alignment" = "Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark")))

texreg(list(m11, m11.5, m13, m13.5),
       file = "Output/enf_industry.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("industry_party" = "Industry Party",
                              "industry_alignment" = "Industry Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m15, m15.5),
       file = "Output/enf_industry_money.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("industry_party" = "Industry Party",
                              "industry_alignment" = "Industry Alignment",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark")))

texreg(list(m16, m16.5, m17, m17.5),
       file = "Output/enf_geography.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("cd_repub_tendency" = "District Republican Tendency",
                              "sec_party:cd_repub_tendency" = "District Republican Tendency $\\times$ SEC Party",
                              "margin" = "Election Margin",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m18, m18.5),
       file = "Output/enf_geography_money.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("cd_repub_tendency" = "District Republican Tendency",
                              "sec_party:cd_repub_tendency" = "District Republican Tendency $\\times$ SEC Party",
                              "margin" = "Election Margin",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_lagged" = "Log(Tot. Contribs.)",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark")))

texreg(list(m19, m19.5, m20, m20.5),
       file = "Output/enf_tot_contribs.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       custom.model.names = c("Enf.",
                              "Enf.",
                              "N. Enf.",
                              "N. Enf."),
       custom.coef.map = list("log_tot_rep_lagged" = "Log(Total Rep. Contribs.)",
                              "log_tot_dem_lagged" = "Log(Total Dem. Contribs.)",
                              "sec_party:log_tot_rep_lagged" = "Log(Total Rep. Contribs.) $\\times$ SEC Party",
                              "sec_party:log_tot_dem_lagged" = "Log(Total Dem. Contribs.) $\\times$ SEC Party",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark")))

texreg(list(m21, m21.5),
       file = "Output/enf_tot_contribs_money.tex",
       stars = c(0.001, 0.01, 0.05, 0.1),
       symbol = "+",
       digits = 3,
       include.proj.stats = FALSE,
       custom.model.names = c("Log(Money)",
                              "Log(Money)"),
       custom.coef.map = list("log_tot_rep_lagged" = "Log(Total Rep. Contribs.)",
                              "log_tot_dem_lagged" = "Log(Total Dem. Contribs.)",
                              "sec_party:log_tot_rep_lagged" = "Log(Total Rep. Contribs.) $\\times$ SEC Party",
                              "sec_party:log_tot_dem_lagged" = "Log(Total Dem. Contribs.) $\\times$ SEC Party",
                              "recent_ca" = "Recent Class Action",
                              "recent_restatement" = "Recent Restatement",
                              "log_tot_comm_contribs_lagged" = "Log(Tot. Comm. Contribs.)",
                              "log_lobbying_lagged" = "Log(Tot. Lobbying Exp.)",
                              "log_lobbying_lagged_sec_rel" = "Log(Tot. SEC-Rel. Lobbying Exp.)",
                              "sbc_rep" = "SBC",
                              "hfsc_rep" = "HFSC",
                              "senApp_rep" = "S. Approp.",
                              "houseApp_rep" = "H. Approp.",
                              "log_cd_unemp_rate" = "Log(CD Unemp. Rate)",
                              "log_cd_finance_workers" = "Log(CD Finance Workers)",
                              "log_at" = "Log(Assets)",
                              "log_emp" = "Log(Employment)",
                              "leverage" = "Leverage",
                              "roa" = "ROA",
                              "op_margin" = "Operating Margin",
                              "finance_x_time" = "Finance $\\times$ Year"),
       custom.gof.rows = list("Firm FE" = c("\\checkmark", "\\checkmark"),
                              "Year FE" = c("\\checkmark", "\\checkmark")))
